package com.keming.dao;

import com.keming.pojo.Type;
import com.keming.pojo.show.FirstPageBlog;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface TypeDao {
//    增
    @Insert("insert into myblog.t_type values (#{id},#{name})")
    int saveType(Type type);
//    删
    @Delete("delete from myblog.t_type where id=#{id}")
    int deleteType(Long id);
//    改
    @Update("update myblog.t_type set name=#{name} where id=#{id}")
    int updateType(Type type);
//    查
    @Select("select * from myblog.t_type where id=#{id}")
    Type getType(Long id);
    @Select("select * from myblog.t_type where name=#{name}")//根据分类名称查询分类
    Type getTypeByName(String name);
    @Select("select * from myblog.t_type")
    List<Type> getAllType();

//    -----------
    //查询所有分类
    List<Type> getAllTypeAndBlog();

}
